home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / desq5x.zip / DESQQWIK.PAS < prev   
Pascal/Delphi Source File  |  1993-01-04  |  4KB  |  93 lines

  1. { =========================================================================== }
  2. { DESQqwik.pas - Demo for DESQview interface routines      ver 5.X, 01-01-89  }
  3. {                and the use of QWIK5X.TPU                                    }
  4. { It is assumed that you are an operator of DESQview and that you are         }
  5. { familiar with it's operation.                                               }
  6. { TO TEST:                                                                    }
  7. {   1. Make DESQdemo.exe with QWIK.TPU.                                       }
  8. {   2. Compile DESQloop.exe.                                                  }
  9. {   3. Add these programs to DV with Direct video = "N".                      }
  10. {   4. Run DESQloop in one or more windows, say 1 and 2.                      }
  11. {   5. Run this program in another one, say 3.                                }
  12. {   6. Observe results.                                                       }
  13. { TO USE:                                                                     }
  14. {   1. Optionally rename DESQ5X.TPU to DESQ.TPU                               }
  15. {   2. Follow instruction provided by DESQview                                }
  16. {   3. For high speed buffer writing to a DESQview window, use QWIK5X.ARC     }
  17. {  by  James H. LeMay, CIS 76011,217                                          }
  18. {  for Eagle Performance Software                                             }
  19. {      P.O. Box 122237                                                        }
  20. {      Ft. Worth, TX  76121-2237                                              }
  21. { =========================================================================== }
  22.  
  23. program DESQdemo;
  24.  
  25. USES Crt,Qwik,DESQ;
  26.  
  27. var
  28.   DV_version: word;
  29.   Strng:      string;
  30.  
  31. type
  32.   Str9 = string[9];
  33.  
  34. { -- Converts any number into a Hex character string -- }
  35. function DecToHex (Number: longint; HexChars: byte): str9;
  36. const
  37.   D2H: array[0..$F] of char = '0123456789ABCDEF';
  38. var
  39.   HexStr:       Str9;
  40.   HexChar,Bits: byte;
  41. begin
  42.   HexStr:='';
  43.   for HexChar:=0 to pred(HexChars) do
  44.     begin
  45.       Bits:=HexChar shl 2;
  46.       HexStr:=D2H[(Number shr Bits) and $F] + HexStr;
  47.     end;
  48.   DecToHex:='$' + HexStr;
  49. end;
  50.  
  51. procedure ClearScr (Attrib: integer);
  52. begin
  53.   Qfill (1,1,CRTrows,CRTcols,Attrib,' ');
  54. end;
  55.  
  56. begin
  57.   Page0seg:=DV_Get_Video_Buffer (Page0seg);    { Base of Video segment }
  58.   QScrSeg:=Page0seg;                           { Segment for Qwik writing }
  59.   DV_Version:=DV_Get_Version;     { Optional }
  60.   if not In_DV then
  61.     begin
  62.       ClearScr (TextAttr);
  63.       Qwrite (1,1,SameAttr,'DESQview not active');
  64.       GotoRC (2,1);
  65.     end
  66.   else
  67.     begin
  68.       { QWIK5X uses FAR pointers for the screen base.  DESQview only
  69.         changes the segment and is therefore paragraph aligned (meaning the
  70.         offset is always 0).  Since DV_Get_Video_Buffer does not work with
  71.         the offset, DESQview assumes it to be zero for the screen base. }
  72.       QScrOfs:=0;   { Screen base offset. }
  73.       Qsnow:=false;
  74.       ClearScr (SameAttr);
  75.       Qwrite    (1,1,SameAttr,'DESQview version = ');
  76.       Str       ((Hi(DV_Version)+Lo(DV_Version)/100):4:2,Strng);
  77.       QwriteEos (    SameAttr,Strng);
  78.       Qwrite    (2,1,SameAttr,'Video Segment = ');
  79.       QwriteEos (    SameAttr,DecToHex(Page0seg,4));
  80.       Qwrite    (3,1,SameAttr,'First character in row 1 is = ');
  81.       QwriteEos (    SameAttr,char(Mem[Page0seg:0]));
  82.       Qwrite    (4,1,SameAttr,'All windows should now freeze for 3 seconds');
  83.       GotoRC    (5,1);
  84.       Crt.delay (1000);
  85.       DV_Begin_Critical;
  86.       Crt.delay (3000);
  87.       DV_End_Critical;
  88.       Qwrite (5,1,SameAttr,'Now all windows will continue.');
  89.       Qwrite (6,1,SameAttr,'Test completed.  Scroll back to see row 1.');
  90.       GotoRC (7,1);
  91.     end
  92. end.
  93.